home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 9
/
Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO
/
047a
/
syswit.exe
/
PLANS.BAS
< prev
next >
Wrap
BASIC Source File
|
1992-01-17
|
5KB
|
184 lines
DefInt A-Z
Sub Frame (F As Form, L, T, H, W, Style)
F.DrawWidth = Style
F.ForeColor = HiColor: If Style = 2 Then F.ForeColor = LoColor
'bottom:
F.Line (L + F.DrawWidth, T + H + OffSet)-(L + W - F.DrawWidth, T + H + OffSet)
'right:
F.Line (L + W + OffSet, T + F.DrawWidth)-(L + W + OffSet, T + H + OffSet - F.DrawWidth)
F.ForeColor = LoColor: If Style = 2 Then F.ForeColor = HiColor
'top:
F.Line (L - BigOffSet + F.DrawWidth, T - BigOffSet)-(L + W + BigOffSet - F.DrawWidth, T - BigOffSet)
'left:
F.Line (L - BigOffSet, T + F.DrawWidth - BigOffSet)-(L - BigOffSet, T + H + BigOffSet - F.DrawWidth)
End Sub
Sub CopyFile (Source As String)
X = FALSE
If UCase$(Source) = "SYSTEM.INI" Then X = MsgBox("Restart using current SYSTEM.INI?", 4, "No Change")
If X = IDYES Then RestartProc
If X = IDNO Then Exit Sub
Destination$ = Windir + "\" + "System.ini"
DestinationBack$ = Windir + "\" + "system.bak"
Source$ = Windir + "\" + Source
On Error Resume Next
Kill DestinationBack$
Name Destination$ As DestinationBack$
Open Source$ For Binary As #1
whole = LOF(1) \ 32000
part = LOF(1) Mod 32000
If whole + part = 0 Then MsgBox Source$ + " not found.": Close : GetProfile: Exit Sub
buffer$ = String$(32000, 0)
start& = 1
Open Destination$ For Binary As #2
On Error GoTo ErrProc
For X = 1 To whole
Get #1, start&, buffer$
Put #2, start&, buffer$
start& = start& + 32000
Next X
buffer$ = String$(part, 0)
Get #1, start&, buffer$
Put #2, start&, buffer$
Close
Call RestartProc
Exit Sub
ErrProc:
MsgBox "Disk error"
Kill Destination$
Name DestinationBack$ As Destination$
End
End Sub
Sub RestartProc ()
Okay% = ExitWindows(&H42, 0)
If Okay% = 0 Then MsgBox "Cannot Restart Windows", 32, "Win Restart"
End
End Sub
Function GetHighLight () As Integer
For I = 0 To 4
If FORM1.Option1(I).Value = TRUE Then GetHighLight = I
Next I
End Function
Sub Openfile (C As Control)
WorkingFileName = Windir + "\SYSWITCH.TXT"
OpenMode% = READFILE
FileNum% = Fileopener(WorkingFileName, OpenMode%, 0)
If FileNum% = 0 Then GoTo OpenErr
On Error GoTo OpenErr
If LOF(FileNum%) > 60000 Then
Msg$ = "Sorry your file is too large to edit."
MsgBox Msg$, 16, "File Too Big"
Exit Sub
End If
Do Until EOF(FileNum%)
Line Input #FileNum%, NextLine$
LineFromFile$ = LineFromFile$ + NextLine$ + Chr$(13) + Chr$(10)
Loop
C.Text = LineFromFile$
Close FileNum%
Exit Sub
OpenErr:
MsgBox "Problem reading " + WorkingFileName
C.Text = "Couldn't read instructions file"
Exit Sub
End Sub
Function Fileopener (NameToUse$, Mode%, RecordLen%) As Integer
Const READFILE = 2
FileNum% = FreeFile
On Error GoTo OpenerError
Open NameToUse For Input As FileNum%
Fileopener = FileNum%
Exit Function
OpenerError:
Fileopener = 0
Exit Function
End Function
Sub CommandTest ()
Com$ = Command$
If Com$ = "" Then Exit Sub
DirCheck:
Slash = InStr(Com$, "\")
If Slash = 0 Then GoTo DirGone
If Slash = Len(Com$) Then GoTo CommandError
Com$ = Mid$(Com$, Slash + 1)
GoTo DirCheck
DirGone:
If Com$ = "" Then Exit Sub
If Len(Com$) > 12 Then GoTo CommandError
Period = InStr(Com$, ".")
If Period < 1 Or Period > 9 Then GoTo CommandError
If Len(Mid$(Com$, Period + 1)) > 3 Then GoTo CommandError
CopyFile (Com$)
Exit Sub
CommandError:
MsgBox Command$ + " is not a legal file name."
Exit Sub
End Sub
Sub RestartWIn ()
For X = 0 To 4
If FORM1.Option1(X).Value = TRUE Then SysFile$ = FileC(X + 1)
Next X
Call CopyFile(SysFile$)
End Sub
Sub GetProfile ()
ProfRead "ConfigName1", NameC(1)
ProfRead "ConfigName2", NameC(2)
ProfRead "ConfigName3", NameC(3)
ProfRead "ConfigName4", NameC(4)
ProfRead "ConfigName5", NameC(5)
ProfRead "ConfigFile1", FileC(1)
ProfRead "ConfigFile2", FileC(2)
ProfRead "ConfigFile3", FileC(3)
ProfRead "ConfigFile4", FileC(4)
ProfRead "ConfigFile5", FileC(5)
End Sub
Sub SaveProfile ()
ProfSave "ConfigFile1", FileC(1)
ProfSave "ConfigFile2", FileC(2)
ProfSave "ConfigFile3", FileC(3)
ProfSave "ConfigFile4", FileC(4)
ProfSave "ConfigFile5", FileC(5)
ProfSave "ConfigName1", NameC(1)
ProfSave "ConfigName2", NameC(2)
ProfSave "ConfigName3", NameC(3)
ProfSave "ConfigName4", NameC(4)
ProfSave "ConfigName5", NameC(5)
End Sub
Sub ProfSave (Label$, Variable$)
X = WritePrivateProfileString(App, Label$, Variable$, Ini)
End Sub
Sub ProfRead (Desire$, Destination$)
Default$ = "Default Configuration"
If Mid$(Desire$, 7, 1) = "F" Then Default$ = "SYSTEM.INI"
RLen = GetPrivateProfileString(App, Desire$, Default$, ReadString, 128, Ini)
Destination$ = Left$(ReadString, RLen)
End Sub
Sub CenterForm (F As Form)
F.Left = (Screen.Width / 2) - (F.Width / 2)
F.Top = (Screen.Height / 2) - (F.Height / 2)
End Sub